<div id="content">
  <div class="row s_page_title">
    <sa-big-breadcrumbs [items]="['算法管理', '环卫结果验证']" icon="fa fa-subscript"
      class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
  </div>
  <sa-widgets-grid>
    <div class="s_table">
      <div sa-widget [editbutton]="false" color="darken" class="clearfix">
        <header>
          <span class="widget-icon"><i class="fa fa-table"></i></span>
          <h2>环卫结果验证</h2>
        </header>
        <div>
          <div class="widget-body no-padding">
            <div class="page-header clearfix s_table_opreation">
              <div class="left page-header-btn" style="width: calc(100% - 300px)">
                <sa-company-tree-car companyTreeId="companyTree"
                  (companySelected)="companySelected($event)"></sa-company-tree-car>

                <div class="top_module top_module_box">
                  <span class="top_module_label module_text">APP类型</span>
                  <select name="" class="top_module_select" [(ngModel)]="appType">
                    <option value="">全部</option>
                    <option value="1">安卓</option>
                    <option value="2">IOS</option>
                  </select>
                </div>

                <!-- <div class="selectDate top_module">
                  <table-select-date
                    [notInit]="false"
                    [initSelectDay]="initSelectDay"
                    (outerTime)="getSelectTableTime($event)"
                  ></table-select-date>
                </div> -->
                <button class="btn btn-primary" (click)="table_search()">查询</button>
                <!-- <button type="button" class="btn btn-primary" (click)="exportData()">导出</button> -->
              </div>
              <div class="right top-search">
                <input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input"
                  placeholder="APP版本、车牌号、设备ID..." />
                <span class="top-search-box">
                  <button class="top-search-btn" type="button" (click)="table_search()">
                    <i class="fa fa-search"></i>
                  </button>
                </span>
              </div>
            </div>
            <div class="table_scroll">
              <table
                class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
                <thead>
                  <tr>
                    <th>车牌号码</th>
                    <th>设备ID</th>
                    <th>公司名称</th>
                    <th>APP类型</th>
                    <th>APP版本</th>
                    <th>车辆类型</th>
                    <th>16通道系数</th>
                    <th>16通道零点值</th>
                    <th>验证文件下载</th>
                    <th>创建时间</th>
                    <th>创建人</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i"
                    [ngClass]="{ selected: activeSelected === row.id }" (dblclick)="checkAbnormal(row)">
                    <td>{{ row.carNumber }}</td>
                    <td>{{ row.deviceId }}</td>
                    <td>{{ row.companyName }}</td>
                    <td>
                      <span *ngIf="row.appType == 1">安卓</span>
                      <span *ngIf="row.appType == 2">IOS</span>
                    </td>
                    <td>{{ row.appVersion }}</td>
                    <td>
                      <span>{{ row.carType === 0 ? '其他' : carTypeEum[row.carType-1] }}</span>
                    </td>
                    <td>
                      <div class="td_flex">
                        <p class="text_ellipsis">{{ row.coef }}</p>
                        <button *ngIf='row.coef' type="button" (click)="showMsgModal(row.coef, '16通道系数', seeMsgModal)">查看</button>
                      </div>
                    </td>
                    <td>
                      <div class="td_flex">
                        <p>{{ row.coefZero }}</p>
                        <!-- <button type="button" (click)="showMsgModal(row.coefZero, '16通道零点值', seeMsgModal)">查看</button> -->
                      </div>
                    </td>
                    <td>
                      <button type="button" (click)="downloadFile(row)">下载</button>
                    </td>
                    <td>{{ row.createTime }}</td>
                    <td>{{ row.createUserName }}</td>
                    <td>
                      <button type="button" (click)="delRow(row)">刪除</button>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="table-fix clearfix">
              <paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
                (onPageChange)="paginate($event)"></paginator>
              <button type="button" class="btn default refresh_btn" (click)="refresh()">
                <i class="fa fa-refresh"></i>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </sa-widgets-grid>

  <!-- 查看详情 -->
  <div bsModal #seeMsgModal="bs-modal" id="seeMsgModal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width: 740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" (click)="cancelMsgModal(seeMsgModal)" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
          <h4 class="modal-title">{{showTitle}}</h4>
        </div>
        <div class="modal-body" style="padding: 15px 15px 30px 15px">
          <p style="width: 700px; overflow-wrap: break-word;">{{showRowMsg}}</p>
        </div>
      </div>
    </div>
  </div>
  <!-- 查看详情 end-->
</div>

<style>
  .text_ellipsis {
    width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .td_flex {
    display: flex;
  }
</style>